import request from '../utils/request'

/**
 * 后面的每次请求需要携带token
 */
export const findUserList = (current,size,userVO) => {
    return request({
        url: "/system/tb-user/",
        method: 'post',
        params: {
            current,
            size
        },
        data: userVO
    })
}


/**
 * 删除OSS中的图片
 */

 export const deleteImgFile=(file) => {
     return request({
         url: "/deleteImgFile",
         method: 'post',
         params: {
             file
         }
     })
 }

 /**
  * 添加用户
  */
//  export const saveUser=(user) => {
//      return request({
//          url:"/system/tb-user/addUser",
//          method: 'post',
//          data: user
//      })
//  }

 /**
  * 根据departmentId选择医生
  */
 export const chooseDoctor = (departmentId) => {
     return request({
         url:"/hospital/user/chooseDoctor/"+departmentId,
         method: 'get',
         
     })
 }

 /**
  * 根据用户Id获得挂号历史记录
  */
  export const getHisList = (userId) => {
      return request({
          url: "/hospital/registration/getHistory/"+userId,
          method: "get",
      })
  }

/**
 * 用户插入挂号记录
 * @param {*} registration 
 */
  export const saveRegistration = (registration) => {
      return request({
          url: "/hospital/registration/saveRegistration",
          method:"post",
          data: registration
      })
  }

  export const getManage=(doctorId) => {
    return request({
        url: "/hospital/registration/getManage/"+doctorId,
        method:"get",
    })
  }

  /**
   * 更新预约状态
   * @param {*} status 
   * @param {*} registrationId 
   */
  export const updateStatus=(status,registrationId) => {
      return request({
          url:"/hospital/registration/updateStatus",
          method:"post",
          params:{
              status,
              registrationId
          }
      })
  }

/**
 * 修改个人信息
 * @param {*} user 
 */
  export const updateUser=(user)=> {
      return request({
          url:"/hospital/user/updateUser",
          method:"post",
          data:user
      })
  }

  /**
   * 分页查询所欲挂号记录
   * @param {*} registration 
   * @param {*} size 
   * @param {*} current 
   */
export const getAll=(registration,size,current)=>{
    return request({
        url:"/hospital/registration/getAll",
        method:"post",
        params:{
            size,
            current
        },
        data:registration
    })
}

/**
 * 分页查询所有医生信息
 * @param {*} doctor 
 * @param {*} size 
 * @param {*} current 
 */
export const getDoctors=(doctor,size,current)=>{
    return request({
        url:"/hospital/user/getDoctors",
        method:"post",
        params:{
            size,
            current
        },
        data:doctor
    })
}

/**
 * 删除医生
 * @param {*} userId 
 */
export const deleteDoctor=(userId)=>{
    return request({
        url:"/hospital/user/deleteById/"+userId,
        method:"get"
    })
}

export const saveUser=(user)=>{
    return request({
        url:"/hospital/user/saveUser",
        method:"post",
        data:user
    })
}

export const getNum=(doctorId)=>{
    return request({
        url:"/hospital/registration/getNum/"+doctorId,
        method:"get"
    })
}